package development;

import state.GameConstants;
import state.GameForm;
import state.GameGlobal;
import state.Graphics;
import state.Key;
import state.font.FontManager;
import state.font.ImageFont;
import state.util.GameColor;
import state.util.Hashtable;

public class FrmTestCustomeAlertUI extends GameForm {
  private FrmTestCheckbox frmTestCheckbox = null;

  private ImageFont text11 = null;

  private static GameForm singleton = null;

  public static GameForm instance() {
    if (singleton == null) {
      singleton = new FrmTestCustomeAlertUI();
    }
    return singleton;
  }

  public void init(Hashtable parameters) {
    _manager.setBackGroundColor(GameColor.GREEN_CODE);

    text11 = FontManager.getFont(FontManager.FONT_SIZE_11);

    frmTestCheckbox = new FrmTestCheckbox();
    frmTestCheckbox.setPosition(20, 20);
    frmTestCheckbox.setSize(200, 200);
  }

  public void draw(Graphics g) {
    text11.drawString2(g, "Press Fire to show alert", GameColor.WHITE_CODE, GameConstants.SCREEN_WIDTH / 2, GameConstants.SCREEN_HEIGHT / 2, GameConstants.CENTER_ANCHOR);
  }

  public void keyReleased(int keyCode) {
    if (keyCode == Key.SOFT_RIGHT) {
      GameGlobal.nextState(FrmMenu.instance(), null);
    } else if (keyCode == Key.FIRE) {
      GameGlobal.alert.showCustomUIAlert(frmTestCheckbox, 0);
    }
  }

  public void alertEventPerform(int alertType, int eventType, int alertId) {
  }

  public void destroy() {
    frmTestCheckbox.detroy();
  }
}
